using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class So_Oe_FMap : EntityTypeConfiguration<So_Oe_F>
    {
        public So_Oe_FMap()
        {
            // Primary Key
            this.HasKey(t => new { t.sumfields, t.dimfields });

            // Properties
            this.Property(t => t.Patient__)
                .HasMaxLength(10);

            this.Property(t => t.Patient)
                .HasMaxLength(110);

            this.Property(t => t.Pat_cur)
                .HasMaxLength(5);

            this.Property(t => t.Document_Type)
                .HasMaxLength(7);

            this.Property(t => t.Bill_cur)
                .HasMaxLength(5);

            this.Property(t => t.batch)
                .HasMaxLength(8);

            this.Property(t => t.Doctor)
                .HasMaxLength(35);

            this.Property(t => t.Document__)
                .HasMaxLength(8);

            this.Property(t => t.PAYTYPE)
                .HasMaxLength(20);

            this.Property(t => t.sumfields)
                .IsRequired()
                .HasMaxLength(30);

            this.Property(t => t.dimfields)
                .IsRequired()
                .HasMaxLength(21);

            // Table & Column Mappings
            this.ToTable("So_Oe_F");
            this.Property(t => t.Patient__).HasColumnName("Patient_#");
            this.Property(t => t.voucher).HasColumnName("voucher");
            this.Property(t => t.Patient).HasColumnName("Patient");
            this.Property(t => t.Pat_cur).HasColumnName("Pat_cur");
            this.Property(t => t.Date).HasColumnName("Date");
            this.Property(t => t.Document_Type).HasColumnName("Document_Type");
            this.Property(t => t.Number).HasColumnName("Number");
            this.Property(t => t.currency).HasColumnName("currency");
            this.Property(t => t.Bill_cur).HasColumnName("Bill_cur");
            this.Property(t => t.Bill_bal_Bill_cur).HasColumnName("Bill_bal_Bill_cur");
            this.Property(t => t.Bill_bal_Patient_cur).HasColumnName("Bill_bal_Patient_cur");
            this.Property(t => t.Bill_balance_b1).HasColumnName("Bill_balance_b1");
            this.Property(t => t.batch).HasColumnName("batch");
            this.Property(t => t.closed_out).HasColumnName("closed_out");
            this.Property(t => t.Note).HasColumnName("Note");
            this.Property(t => t.Doctor).HasColumnName("Doctor");
            this.Property(t => t.Document__).HasColumnName("Document_#");
            this.Property(t => t.PAYTYPE).HasColumnName("PAYTYPE");
            this.Property(t => t.related_bill_of_payment).HasColumnName("related_bill_of_payment");
            this.Property(t => t.sumfields).HasColumnName("sumfields");
            this.Property(t => t.dimfields).HasColumnName("dimfields");
        }
    }
}
